/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author flore_tchouanguem
 */
@Entity
@Table(name = "Document")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Document.findAll", query = "SELECT d FROM Document d"),
    @NamedQuery(name = "Document.findByIdDocument", query = "SELECT d FROM Document d WHERE d.idDocument = :idDocument"),
    @NamedQuery(name = "Document.findByNomDocument", query = "SELECT d FROM Document d WHERE d.nomDocument = :nomDocument"),
    @NamedQuery(name = "Document.findByAuteurDocument", query = "SELECT d FROM Document d WHERE d.auteurDocument = :auteurDocument"),
    @NamedQuery(name = "Document.findByTailleDocument", query = "SELECT d FROM Document d WHERE d.tailleDocument = :tailleDocument"),
    @NamedQuery(name = "Document.findByListeMotClesDocument", query = "SELECT d FROM Document d WHERE d.listeMotClesDocument = :listeMotClesDocument"),
    @NamedQuery(name = "Document.findByDateCreation", query = "SELECT d FROM Document d WHERE d.dateCreation = :dateCreation"),
    @NamedQuery(name = "Document.findByDateMiseAjour", query = "SELECT d FROM Document d WHERE d.dateMiseAjour = :dateMiseAjour"),
    @NamedQuery(name = "Document.findByLienDeTelechargement", query = "SELECT d FROM Document d WHERE d.lienDeTelechargement = :lienDeTelechargement")})
public class Document implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idDocument")
    private Integer idDocument;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 256)
    @Column(name = "nomDocument")
    private String nomDocument;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "auteurDocument")
    private String auteurDocument;
    @Basic(optional = false)
    @NotNull
    @Column(name = "tailleDocument")
    private int tailleDocument;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 256)
    @Column(name = "listeMotClesDocument")
    private String listeMotClesDocument;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateCreation")
    @Temporal(TemporalType.DATE)
    private Date dateCreation;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateMiseAjour")
    @Temporal(TemporalType.DATE)
    private Date dateMiseAjour;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 256)
    @Column(name = "lienDeTelechargement")
    private String lienDeTelechargement;
    @JoinColumn(name = "catDocument", referencedColumnName = "idCategorieDocument")
    @ManyToOne(optional = false)
    private CategorieDocument catDocument;

    public Document() {
    }

    public Document(Integer idDocument) {
        this.idDocument = idDocument;
    }

    public Document(Integer idDocument, String nomDocument, String auteurDocument, int tailleDocument, String listeMotClesDocument, Date dateCreation, Date dateMiseAjour, String lienDeTelechargement) {
        this.idDocument = idDocument;
        this.nomDocument = nomDocument;
        this.auteurDocument = auteurDocument;
        this.tailleDocument = tailleDocument;
        this.listeMotClesDocument = listeMotClesDocument;
        this.dateCreation = dateCreation;
        this.dateMiseAjour = dateMiseAjour;
        this.lienDeTelechargement = lienDeTelechargement;
    }

    public Integer getIdDocument() {
        return idDocument;
    }

    public void setIdDocument(Integer idDocument) {
        this.idDocument = idDocument;
    }

    public String getNomDocument() {
        return nomDocument;
    }

    public void setNomDocument(String nomDocument) {
        this.nomDocument = nomDocument;
    }

    public String getAuteurDocument() {
        return auteurDocument;
    }

    public void setAuteurDocument(String auteurDocument) {
        this.auteurDocument = auteurDocument;
    }

    public int getTailleDocument() {
        return tailleDocument;
    }

    public void setTailleDocument(int tailleDocument) {
        this.tailleDocument = tailleDocument;
    }

    public String getListeMotClesDocument() {
        return listeMotClesDocument;
    }

    public void setListeMotClesDocument(String listeMotClesDocument) {
        this.listeMotClesDocument = listeMotClesDocument;
    }

    public Date getDateCreation() {
        return dateCreation;
    }

    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }

    public Date getDateMiseAjour() {
        return dateMiseAjour;
    }

    public void setDateMiseAjour(Date dateMiseAjour) {
        this.dateMiseAjour = dateMiseAjour;
    }

    public String getLienDeTelechargement() {
        return lienDeTelechargement;
    }

    public void setLienDeTelechargement(String lienDeTelechargement) {
        this.lienDeTelechargement = lienDeTelechargement;
    }

    public CategorieDocument getCatDocument() {
        return catDocument;
    }

    public void setCatDocument(CategorieDocument catDocument) {
        this.catDocument = catDocument;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDocument != null ? idDocument.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Document)) {
            return false;
        }
        Document other = (Document) object;
        if ((this.idDocument == null && other.idDocument != null) || (this.idDocument != null && !this.idDocument.equals(other.idDocument))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.Document[ idDocument=" + idDocument + " ]";
    }
    
}
